package com.wechat.back.service.impl;

import com.wechat.back.mapper.AdminMapper;
import com.wechat.back.pojo.Admin;
import com.wechat.back.service.AdminService;
import com.wechat.back.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper AdminMapper;
    @Override
    public Admin findByAdminName(String adminName) {
        Admin a = AdminMapper.findByAdminName(adminName);
        return a;
    }

    @Override
    public void register(String adminName, String password) {
        //加密
        String md5String = Md5Util.getMD5String(password);
        //添加
        AdminMapper.add(adminName, md5String);
    }

}
